{% extends 'base.html' %}
{% load mytags %}
{% load static %}

{% block title %}
    <title>所有文章类型</title>
{% endblock %}

{% block content %}
    <!--中间内容-->
    <div class="m-container-small m-padded-tb-big">
        <div class="ui container">
            <!--header-->
            <div class="ui top attached segment">
                <div class="ui middle aligned two column grid">
                    <div class="column">
                        <h3 class="ui teal header">分类</h3>
                    </div>
                    <div class="right aligned column">
                        共 <h2 class="ui orange header m-inline-block m-text-thin">{{ type_blog }} </h2> 个
                    </div>
                </div>
            </div>

            {% show_all_types %}

            <div class="ui top attached teal segment">
                {% for blog in page_obj %}
                    <div class="ui padded vertical segment m-padded-tb-large m-mobile-lr-clear">
                        <div class="ui mobile reversed stackable grid">
                            <div class="eleven wide column">
                                <a href="{{ blog.get_absolute_url }}"><h3 class="ui header">{{ blog.title }}</h3></a>
                                <p class="m-text">{{ blog.desc }}</p>
                                <div class="ui stackable grid">
                                    <div class="row">
                                        <div class="eleven wide column">
                                            <div class="ui mini horizontal link list">
                                                <div class="item">
                                                    <img src="https://avatars.githubusercontent.com/u/23349356" alt=""
                                                         class="ui avatar image">
                                                    <div class="content">
                                                        <a href="#" class="header">{{ blog.author.get_full_name }}</a>
                                                    </div>
                                                </div>
                                                <div class="item">
                                                    <i class="calendar icon"></i> {{ blog.created }}
                                                </div>
                                                <div class="item">
                                                    <i class="eye icon"></i> {{ blog.total_views }}
                                                </div>
                                            </div>
                                        </div>
                                    </div>
                                    <div class="row">
                                        <div class="column">
                                            <a href="{% url 'blog:type_detail' blog.category.id %}"
                                               class="ui  basic teal left pointing label m-padded-mini m-text-thin">{{ blog.category }}</a>
                                        </div>
                                    </div>
                                </div>
                            </div>
                            <div class="five wide column">
                                <a href="#" target="_blank">
                                    <img src="{{ blog.image.url }}" alt="" class="ui rounded image">
                                </a>
                            </div>
                        </div>
                    </div>
                {% endfor %}
            </div>
            {% include 'page.html' %}
            {#            <div class="ui bottom attached segment">#}
            {#                <div class="ui middle aligned two column grid">#}
            {#                    {% if page_obj.has_previous %}#}
            {#                        <div class="column">#}
            {#                            <a href="?page={{ page_obj.previous_page_number }}"#}
            {#                               class="ui mini teal basic button">上一页</a>#}
            {#                        </div>#}
            {#                    {% else %}#}
            {#                        <div class="column">#}
            {#                            <a class="ui mini teal basic button disabled">上一页</a>#}
            {#                        </div>#}
            {#                    {% endif %}#}
            {##}
            {#                    {% if page_obj.has_next %}#}
            {#                        <div class="right aligned column">#}
            {#                            <a href="?page={{ page_obj.next_page_number }}" class="ui mini teal basic button">下一页</a>#}
            {#                        </div>#}
            {#                    {% else %}#}
            {#                        <div class="right aligned column">#}
            {#                            <a class="ui mini teal basic button disabled">下一页</a>#}
            {#                        </div>#}
            {#                    {% endif %}#}
            {#                </div>#}
            {#            </div>#}
        </div>
    </div>
    <br>
    <br>
{% endblock %}

{% block javascript %}
    <script src="https://cdn.jsdelivr.net/npm/jquery@3.2/dist/jquery.min.js"></script>
    <script src="https://cdn.jsdelivr.net/semantic-ui/2.2.4/semantic.min.js"></script>
    <script>
        $('.menu.toggle').click(function () {
            $('.m-item').toggleClass('m-mobile-hide');
        });
    </script>
{% endblock %}
